package com.order.controller.business;

import com.jfinal.core.Controller;
import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Page;
import com.order.config.Consts;
import com.order.model.Dish;
import com.order.model.OrderLine;

@ControllerBind(controllerKey = Consts.BUSINESS + "dish")
public class DishController extends Controller {

	/** 
	* @Title: getDishDetial 
	* @描述:    获取菜品详情
	*/ 
	public void getDishDetial(){
		String cuisineDishId = getPara("cuisine_dish_id");
		int page = getParaToInt("page", 1);
		int pageSize = getParaToInt("pageSize", 10);
		Dish dish = Dish.dao.getDishInfo(cuisineDishId);
		setAttr("dish", dish);
		Page<OrderLine> list = OrderLine.dao.getEvaluation(page, pageSize, cuisineDishId);
		setAttr("evaluation", list.getList());
		setAttr("total", list.getTotalPage());
		setAttr("page", page);
		setAttr("pageSize", pageSize);
		System.out.println(dish);
		System.out.println(list.getList());
		render(Consts.BUSINESS + "dish.htm");
	}
	
	
}
